package thread;

/**
 * @author Bboy Dday
 * @create 2020:06:10:19:43
 */
public class Practice {
    public static void main(String[] args) {

//        MyThread1 t1 = new MyThread1();
//        MyThread2 t2 = new MyThread2();
//
//        t1.start();
//        t2.start();

        new Thread() {
            public void run() {
                for (int i = 0; i < 100; i++) {
                    if (i % 2 == 0) {
                        System.out.println(currentThread().getName() + " : " + i);
                    }
                }
            }
        }.start();

        new Thread(){
            public void run(){
                for (int i = 0; i < 100; i++) {
                    if ( i % 2 != 0 ){
                        System.out.println( currentThread().getName() + " : " + i );
                    }
                }
            }
        }.start();

    }
}

class MyThread1 extends Thread{

    @Override
    public void run(){
        for (int i = 0; i < 100; i++) {
            if ( i % 2 == 0 ){
                System.out.println( currentThread().getName() + " : " + i );
            }
        }
    }

}

class MyThread2 extends Thread{

    @Override
    public void run(){
        for (int i = 0; i < 100; i++) {
            if ( i % 2 != 0 ){
                System.out.println( currentThread().getName() + " : " + i );
            }
        }
    }

}